package com.itheima.springboottest.mapper;
import com.itheima.springboottest.pojo.User;
import org.apache.ibatis.annotations.*;

@Mapper
public interface UserMapper {

    @Select("select  * from  user where  id = #{id}")
     User findById(Integer id);

    @Insert("insert into user(username,password,create_time,update_time)" +
            " values(#{username},#{password},now(),now())")
    void registerUser(@Param("username") String username, @Param("password") String password);

    @Select("select  * from  user where  username = #{username}")
    User findByUserName(String username);

    @Update("update user set nickname=#{nickname},email=#{email},update_time=#{updateTime} where id=#{id}")
    void update(User user);
}
